package com.example.producer;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * @Classname ProducerController
 * @Description
 * @Author caozhenhao001
 * @Date 2024/4/9
 * @Version
 */
@Controller
public class ProducerController {

    @Autowired
    MessageSender messageSender;

    private static final String TOPIC = "broker-a";
    @GetMapping("/test/{message}")
    public void sendMessage(@PathVariable String message) {
        System.out.println("send message:"+message);
        messageSender.pushNormalMessage(TOPIC, message);
    }
}
